package base.io;

import java.io.*;

public class BufferedReaderAndWriter {
  
  private static String COMMON_PATH = "E:%stest%s";
  
  public static void main(String[] args) throws IOException {
    File inputFile = new File(String.format(COMMON_PATH + "reader.md", File.separator, File.separator));
    File outputFile = new File(String.format(COMMON_PATH + "writer.md", File.separator, File.separator));
    
    FileReader fileReader = new FileReader(inputFile);
    FileWriter fileWriter = new FileWriter(outputFile);
    
    BufferedReader bufferedReader = new BufferedReader(fileReader);
    BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
    
    char[] chars = new char[30];
    int readLength = 0;
    while ((readLength = bufferedReader.read(chars)) != -1)
      bufferedWriter.write(chars, 0, readLength);
    
    bufferedReader.close();
    bufferedWriter.close();
    
    System.out.println("复制结束 ......");
  }
}
